const fs = window.require("fs")
const fsPro = fs.promises

// const path = require("path")
// console.log(fs);
// console.log(path)
const fileHelper = {
  readFile:(path)=>{
    return  fsPro.readFile(path,{encoding:'utf8'})
  },
  writeFile:(path,content)=>{
    return fsPro.writeFile(path,content,{encoding:'utf8'})
  },
  renameFile:(path,newPath)=>{
    return fsPro.rename(path,newPath)
  },
  deleteFile:(path)=>{
    return fsPro.unlink(path)
  },
  hasFile:(path)=>{
    return fsPro.access(path)
  },
  statFile:(path)=>{
    return fsPro.stat(path)
  },
  //阻塞方法
  statSyncFile:(path)=>{
    return fs.statSync(path)
  }
}

export default fileHelper;


// const testPath = path.join(__dirname,"help.js")
